<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>打印面单</title>

    <link href="../../rs/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="../../rs/plugins/bootstrap_tab/css/bootstrap-table.css" rel="stylesheet">
    <link href="../../rs/css/animate.min.css" rel="stylesheet">
    <link href="../../rs/css/style.min862f.css?v=4.1.0" rel="stylesheet">

    <style>
        .st{
            padding: 5px 15px 5px 15px;

            text-align: center;
        }
        .sl{
            padding: 5px 15px 5px 15px;


        }
        .st>div{
            display: inline-block;
        }
        @media print {
            #dybutton { display: none; }
        }
    </style>
</head>
<body>
<div id="miandan"  >
    <script type="text/template" id="miandan_template">
            {{~ it:a:index }}
            <div style="margin:10px">
                <div class="st">
                        <span style="font-weight: bold;">历史订单</span>
                </div>
                <div class="st">
                        <span >公司地址：上海市古美路</span>
                </div>
                <div class="st">
                          <span>单据编号：{{=a.djbh}}</span>
                </div>
                <div class="sl">
                          <span>测试：aaa</span>
                          <span style="float: right;">测试：bbb</span>
                </div>
                <div class="st">


                    <table width="100%" border="1" cellspacing="0">
                      <tr>
                          <th>商品名称</th>
                          <th>库存数</th>
                          <th>数量</th>
                      </tr>
                      {{~ a.detail:b }}
                          <tr>
                            <td>{{=b.prmc}}</td>
                            <td>{{=b.kc}}</td>
                            <td>{{=b.sl}}</td>
                        </tr>
                     {{~}}

                  </table>
                </div>
            </div>
            <div style="clear:both"></div>


                <!-- <div class="st">
                    <div>
                        <span>&nbsp;&nbsp; </span>
                        <span>{{=a.djbh}}</span>
                    </div>

                </div> -->


            {{? (it.length-1)==index}}
            <div style="display: none;"></div>
            {{??}}
            <div style="page-break-after:always"></div>
            {{?}}
            {{~}}
            <!-- <div style="height: 40px;line-height: 39px;text-align: center;margin-top: 10px;">
                <button style="margin:0 auto;width: 20%;border-radius: 3px;background-color: #e8e4eb;padding: 10px 20px;" id="dybutton" onclick="day()">打印面单</button>
            </div> -->
    </script>
</div>
<script src="../../rs/js/jquery.min.js"></script>
<script src="../../rs/js/doT.min.js"></script>
<script src="../../rs/js/store.min.js"></script>
<script src="../../rs/js/api.js"></script>
<script>
    $(function(){
        //打开的打印机
        window.print();

        //获取store的值
        //var data=store.get("dy");
        console.log(data);
        var data={
                  "data": [
                      {
                          "djbh": "002",
                          "djmc": "饮料",
                          "detail": [
                              {
                                  "prmc": "10元水",
                                  "kc": "1.00",
                                  "sl": "10.00"
                              },
                              {
                                  "prmc": "尖椒牛肉套餐",
                                  "kc": "1.00",
                                  "sl": "24.00"
                              }
                          ]
                      },
                      {
                          "djbh": "003",
                          "djmc": "麻辣烫",
                          "detail": [
                              {
                                  "prmc": "麻辣烫",
                                  "kc": "1.00",
                                  "sl": "25.96"
                              },
                              {
                                  "prmc": "尖椒牛肉套餐",
                                  "kc": "1.00",
                                  "sl": "24.00"
                              }
                          ]
                      }
                  ]
                };

console.log(data);
        //获取miandan_template下的html格式
        dot = doT.template($("#miandan_template").html());
        $("#miandan").html( dot( data.data ) );
    });
    function day(){
        window.print();
    }
</script>
</body>
</html>
